<%@ include file="/includes.jsp" %>
<%@ include file="/header.jsp" %>


<h2>Event Details</h2>

<form:form modelAttribute="event">
    <%--<form:hidden path="id"/>--%>
    <table>
        <tr>
            <td>Event Name:</td>
            <td><form:input path="name" size="30" readonly="true" maxlength="30"/></td>
        </tr>
        <tr>
            <td>Event Description:</td>
            <td><form:textarea path="description" readonly="true"/></td>
        </tr>
        <tr>
            <td>Location:</td>
            <td><form:input path="location" size="30" readonly="true" maxlength="30"/></td>
        </tr>
        <tr>
            <td>Start time:</td>
            <td><form:input path="startTime" size="30" readonly="true" maxlength="30"/></td>
        </tr>
        <tr>
            <td>End time:</td>
            <td><form:input path="endTime" size="30" readonly="true" maxlength="30"/></td>
        </tr>
    </table>
</form:form>

<h2>Positions for event: ${event.name}</h2>

<table>
    <thead>
    <tr>
        <th>Position</th>
        <th>Location</th>
        <th>Count</th>
        <th>Start Time</th>
        <th>End Time</th>
        <th>Availability</th>
    </tr>
    </thead>
    <c:if test="${empty event.unfilledPositions}">
        <tr>
            <td colspan="6">
                No positions have opportunities for this event.
            </td>
        </tr>
    </c:if>
    <c:if test="${not empty event.unfilledPositions}">
        <c:forEach var="position" items="${event.unfilledPositions}">
            <tr>
                <td><a href="../position/details?eventId=${event.id}&id=${position.id}">${position.name}</a>
                </td>
                <td>${position.location}</td>
                <td>${position.count}</td>
                <td>${position.startTime}</td>
                <td>${position.endTime}</td>
                <td>
                    <form method="GET" action="<c:url value="../position/volunteer"/>" name="volunteer"/>
                    <input type="hidden" name="eventId" value="${event.id}"/>
                    <input type="hidden" name="id" value="${position.id}"/>
                    <input class="submit" type="submit" value="Volunteer"/>
                    </form>
                </td>
            </tr>
        </c:forEach>
    </c:if>
</table>

<%@ include file="../footer.jsp" %>